fixed bug in database library