fixed printing and errorlog