Fixed error with database