Working fix, need better explanation of why this works.