added invalid configutation checking