fix to quit when constraints are satisfied