fixed incorrect error logging