Added null checks for constructor parameters