Trying to locate problem in php script