Updated Error code to work on macs.