works properly with templates now.