add fbsd support and cleanup