Misc improvements, deal with OS variations