check whether gem already exists before adding it