Fixed problems pointed out by Alex.