general fixes and improvements