Fix deprecation warnings in template