updated with changes from mac-support branch