more fixes and cleanup