Fix the db code as previous didn't seem to work on device.