fixes #29, also fixed a null reference in CLR code