misc cleanup and fixing