fixed bugs

fixed bugs  with functions that returning (unit, location) handle