fixed logError code