Update megacore.js

Merged with server.js nya.