Added config check to prevent crashes

Fixes part of #618