Fix wrong condition for error string assignment