fixed a deadly bug causing violation