Changed logic due to setting 312 not always returning to 0.

Changed logic due to setting 312 not always returning to 0 resulting in new boxes not being opened.