fixed warnings and replaced error output with exitcode