Fix for the open/close bug