Bugs fixed & new functions for spare matrix