untested merge from compat, hopefully fix osx

Signed-off-by: Stanislaw Halik <sthalik@misaki.pl>