modified the escaping method