lot of general fixes