Fix template loading bug