Fix flags bug hasattr returns True if the attribute is None
Fix flags bug hasattr returns True if the attribute is None

Use forward references for type hinting in entity

joetsoi/moonstone,joetsoi/moonstone