Support value output with correct type

https://gist.github.com/anonymous/7208905

Reported by Genki Takiuchi. Thanks!!!