Apply changes from croggle commit fc2d9264ff23509285f3b36a321f3dd948ec9571