piles of fixes, still debugging