Fix problems identified in #3