Redo #1548 for the master branch

Switch statement within loop doesn't recognize 'continue' if case is wrapped in { }
Also for #1579