Fixed #3
Renamed beforeopen to beforeOpen