ugly fix for core dump, but fixing anyway