Added first bad input test, and fixed its related bug