Small improvements and PHP fixes