fixing a JS message passing bug