fix input handling