Fixing template bug