fix an error with obtaining id which user specified for get action
fix a memory leak during database closing