Fixed bug in swap color and changed mem threshold