added null check to where we insert elements into a project
added file ref null check