Fixing keyboard interrupt problem