more fixes and some cleanup