fixed problem with template implementation