fixed some problems and added EventEmitter inheritation