and some php improvements