Fixed errors with pressing cancel in dialog boxes