bug fixes for power flow