fix for BSD's expr - $i needs to be initialized