some compiling errors fixed but still not compiling due to template function decoder