bugfix with log_level in case of logging into stderr, fixed cast worning