Add validation for get_diff's result (fixes #478)