Fixes and improvements