used setattr method instead of global variable
added mem usage check for cluster related #16