correct php code and add some options to graphics