add restrict in a few places