Fixed small bug and callbacks in database