Fixed database issue for newer versions of php