Fix a few problems introduced in previous commit