fix crash when accesing null objects