Fix various user panel problems on FreeBSD
Please see commit messages for details. It is a follow-up of !362 (merged) to fix a linking error and a crash on FreeBSD.
Please see commit messages for details. It is a follow-up of !362 (merged) to fix a linking error and a crash on FreeBSD.