multiple cleanups and fixes