Some Fixes and improvements