buffer overflow in prompt() when cancelling; also, parameters swapped