fix control path logic