Fixed PHP notices and warning