old gem cleanup bug fix