This seems to be a better fix but I don't know why it's working better then the previous one.