Multiple fixes and improvements