diff --git a/src/api/allocate.c b/src/api/allocate.c
index b11b911e29c336939212d888c9ade53e74f4315b..2b69a45db9bac1a6b655bac2a705c80787178df3 100644
--- a/src/api/allocate.c
+++ b/src/api/allocate.c
@@ -306,7 +306,7 @@ static int _nodelist_from_hostfile(job_step_create_request_msg_t *req)
 	char *nodelist = NULL;
 	
 	if (hostfile = (char *)getenv("MP_HOSTFILE")) {
-		if(strlen(hostfile)<1)
+		if(strlen(hostfile)<1 || !strcmp(hostfile,"NULL")) 
 			goto no_hostfile;
 		if((hostfilep = fopen(hostfile, "r")) == NULL) {
 			error("slurm_allocate_resources "