added mac compatibility