Partly revert 04175466 to fix segfault and check for type being empty