added mutex to keyboard input