Improve Apache syntax style
Fix opening new document with reopen event (fix #261)