fixed undef vars