Actually fixed bug, but it's not the best solution