fix for Preview Template function