Update mb-server.js

racing condition and masking bugs