add lock checking for record getting; fix some safe container writing check