Fixed unused imports and undefined variables in sparsecf.py