Fix immutable optimizations #19