Adapted for clang (FreeBSD11)