fix processing of multiple commands in the same buffer