WIP fix infinite loop problems