fix bug where setting $ip to 0 doesn't work