fixed bug in database lookup