fix variable undefined
fix class typeinference