updated for using new api, added python code for normalizing matrix (deal with all zero columns)