Fixed issues pointed out by Johan.