Moved framecounter check to loop head