updated to work with newest crafty version