make functions safer to placate openbsd