Fixed convert() function