Fixing PHP bug