add Context.java, fix many reference problems