Fix #1035 by checking for exceptions when accessing config