ex_cmds2.c:fix for issue #1164

fix condition while iterating over all buffers
Merge pull request #1167 from atwupack/fix-issue-1164

ex_cmds2.c:fix for issue #1164