Fix problems pointed out by Frank