[#169] Check that variable are not None before accessing attributes