add check for null before creating table