added debug output to handle key