Fix custom functions for BSD. Refs #42