fix input reading