fix wrong if check
merge fixes in imsg.c
Merge branch 'master' into portable