Fix default value assignment and improve errors.