Fix some weird code written at stupid times of night