Moved line="" to before mode check to stop it breaking when the mode is not "stepmode"