Fixes codesake/codesake_dawn#9 by adding more logic to loop