Added null guard for projectId