bug fix
bug fixes and faster conversion code