Fixed error output to file