working under mac and linux.
fixed bug: linux must init the value of variable