Fixed 'error is undefined'