Fix auth cancellation patch

Check command input buffer instead of the last command argument.
Fix next argument index value.