fix a bug in get_internal() and add more test cases