diff --git a/contribs/torque/qsub.pl b/contribs/torque/qsub.pl
index 142f50cb8d27f84e45170fa05d2f78ce31c1ffb9..ecd0227785291cdba671f6306de5a54850936cff 100755
--- a/contribs/torque/qsub.pl
+++ b/contribs/torque/qsub.pl
@@ -249,11 +249,11 @@ if ($variable_list) {
 	my @parts = $variable_list =~ m/(?:(?<=")[^"]*(?=(?:\s*"\s*,|\s*"\s*$)))|(?<=,)(?:[^",]*(?=(?:\s*,|\s*$)))|(?<=^)(?:[^",]+(?=(?:\s*,|\s*$)))|(?<=^)(?:[^",]*(?=(?:\s*,)))/g;
 	foreach my $part (@parts) {
 		my ($key, $value) = $part =~ /(.*)=(.*)/;
-		if ($key && $value) {
+		if (defined($key) && defined($value)) {
 			$command .= "$separator";
 			$command .= "$key=$value";
 			$separator = ",";
-		} elsif ($ENV{$part}) {
+		} elsif (defined($ENV{$part})) {
 			$command .= "$separator";
 			$command .= "$part=$ENV{$part}";
 			$separator = ",";
diff --git a/src/plugins/task/cray/task_cray.c b/src/plugins/task/cray/task_cray.c
index d3810f9cdb6b40479f244d59497d3c89d7d3e96b..0a8a2324a28a5da158ec0aa2810122a32f5c3547 100644
--- a/src/plugins/task/cray/task_cray.c
+++ b/src/plugins/task/cray/task_cray.c
@@ -323,7 +323,6 @@ extern int task_p_post_term (stepd_step_rec_t *job,
 	char llifile[LLI_STATUS_FILE_BUF_SIZE];
 	char status;
 	int rv, fd;
-	stepd_step_info_t *task;
 	char *reason;
 
 	debug("task_p_post_term: %u.%u, task %d",
@@ -372,7 +371,6 @@ extern int task_p_post_term (stepd_step_rec_t *job,
 
 	// Check the result
 	if (status == 0 && !terminated) {
-		task = job->task[job->envtp->localid];
 		if (task->killed_by_cmd) {
 			// We've been killed by request. User already knows
 			return SLURM_SUCCESS;
diff --git a/src/slurmctld/job_scheduler.c b/src/slurmctld/job_scheduler.c
index b10499f2d617def7a0a707dc9e91b204d364d246..ac8ef2070f7079e69e29600e11fcc26f8a964841 100644
--- a/src/slurmctld/job_scheduler.c
+++ b/src/slurmctld/job_scheduler.c
@@ -1984,6 +1984,10 @@ extern int update_job_dependency(struct job_record *job_ptr, char *new_depend)
 			/* old format, just a single job_id */
 			if (array_task_id == NO_VAL) {
 				dep_job_ptr = find_job_record(job_id);
+				if (!dep_job_ptr) {
+					dep_job_ptr = find_job_array_rec(job_id,
+								      INFINITE);
+				}
 				if (dep_job_ptr &&
 				    (dep_job_ptr->array_job_id == job_id) &&
 				    (dep_job_ptr->array_task_id != NO_VAL)) {
@@ -2050,6 +2054,10 @@ extern int update_job_dependency(struct job_record *job_ptr, char *new_depend)
 			}
 			if (array_task_id == NO_VAL) {
 				dep_job_ptr = find_job_record(job_id);
+				if (!dep_job_ptr) {
+					dep_job_ptr = find_job_array_rec(job_id,
+								      INFINITE);
+				}		
 				if (dep_job_ptr &&
 				    (dep_job_ptr->array_job_id == job_id) &&
 				    (dep_job_ptr->array_task_id != NO_VAL)) {