fixing some bugs that occur in newer versions of node