Fix type-instability problem in restrict!