more fixes to bring php 5.3 support