Added lock to dict_inc

Making it threadsafe