Some bug fixes and reorg Dict.Learning.