Oops, fixing a bug I've introduced due to lack of logic understanding