Fixed PHP errors +  warnings