various changes and fixes