fix start and end while downloading
added timeout to downloading

refactored event emitting