some fixes. Not all done yet