improvements to base conversion