bugfix: typo on type of input_val and casting pointer for comparsion