Fix weird bug with globals and add some examples