fix empty files bug, a few details