Tried to fix entity nullexception bug