several tweaks and fixes