fix some bugs in wrapper of canonical()