tried allocating var in switch