Fix Meteor integration and make it more robust

Fix issues encountered in PR #2059.