Fixed unit tests. Added handler registration null check (thanks Kari!)