fix bug - error is not defined