avoided using hasattr, instead use field flags
removed unused import