Fix conversion routines

Signed-off-by: Maxim Osipov <maxim.osipov@gmail.com>