Fix an IllegalStateException