change check empty dir method. using if (( 0 ))