Fixes NoneType issue