add check that we aren't already optimizing

close #483