Updates code to make it work with php 5.3