I'll test this but here and 2 lines below some nicer error message for the NPEs would be good in a follow up commit