Added fix for NPE, added new brilliant tests.