Fixed backcompatibility sparse matrix building