Add workaround for zero-byte files, listen to certain events only once, and improve comments