Fixed a logical error returning None no matter what