working on fix for some bugs