Add sourceMap support, fix some bugs