TypeError: Cannot apply "with" to non script object