minor tweaks - still WIP for php 5.4 compatibility