small fixes in escape function