Add null checks to make sure push doesn't get a null dir