fixed bug with database