emit parser error on empty files
refactor stream fetching code