Check for invalid callback return value

Check for invalid callback return value NULL added (also for the case, that no value is returned)