fix access to NoneType