fixes to egefac() logic

Several fixes to abnormal behavior in ```egefac()```