Fixed small error in input logic function