Final changes to make the it compatible with FreeNAS 9.1

Import commit de7b9f7e10dd6f70a54bda68e7d55f4f4edf6e50 from williambr