Fixed usage of global pygreen and add some tests