Fixed undefined variable in error message