more improvements and fixes