Fix potential input bug