added check for import modules and flasg for config writting