Fixed error with None-type