Fixed bug in database