Fixes for crashes when no data is returned in some cases