fix invalid input callback logic