fixed up some debug stuff and added collections support