dope constants and memory leak fix