fixed this fucking function andrew merge this please