added check for esc