added constraints
fixed nil