Fixed php 5.2 issues