fix type where error was used as a local variable where message should have been