fixed null issues in sql file