variable reference error in auto class