Fix bug with blank nodes; improve scripts