Added some error guarding for mis-configuration problems.