Fix #1040: panic on start up