Fixes to PHP bug because of my laziness in the past. Final changes locally