Fix some issues so tests pass