Fixed "name 'os' is not defined" crash