Fixed part of the bug, still breaks sometimes