Fix problems claudep pointed out