Re-apply my changes from 4766-raw-file-crash
Re-apply my changes from 4766-raw-file-crash

Redmine #4766

ENCODE-DCC/encoded,T2DREAM/t2dream-portal,T2DREAM/t2dream-portal,ENCODE-DCC/encoded,T2DREAM/t2dream-portal,ENCODE-DCC/encoded,T2DREAM/t2dream-portal,ENCODE-DCC/encoded