Fix some code for using terracotta