new version of lib_occurences script