bugfix of the restrict function