clean up some code giving php notices/warnings