fixed poor php coding