fixed a possible IllegalArgumentException