Fixed issues when run with php-ng