Fixing bug in conversion

This fixes a bug pointed out by @vikynandha