Fix return type mismatch of as_html