Fix Cmd::BufferCommandText to insert commands in the proper position