make type checking more generic in to_char() for issue #189