fixed various things to make tokens work