Fixes two bugs (64bit assumption and template repeat call)