fixed compatibility errors with php5.3 (fixed #7)