Import fixes

and logic fixes