Improvements and fixes for esmtool.