Alot of bug fixes to work with nashorn and npm modules