update db and check function