Fixes endless loop