Fix for reading template files greater than initial buffer size