fix reflection warnings, and remove unused 'diff' function