Bug fixes for the foam simulation 1.0