Fix on node, error: "document is not defined"