Added checks for null source/fn etc.