make sure all db/cursor are closed; refine the return values of methods