Fixed bug in conversion of bases