various fixes and improvements all around