fix bug in conversion logic.