more php bug fixes