MAC-OS: Fixed issues to make it work on MAC-OS.