Fix and failing test case for #988

sometimes crashes with EXC_BAD_ACCESS or unrecognized selector exception