Fixed the input stopping method.