Fix passing around and returning immutable objects