few improvements and fixes