avoid using hasattr, using a flag instead
Added to avoid hasattr() for related fields