fixed error when no record is found