fixed return values of toggle hex function