Fixed readlink for OS X

It might not be the most elegant way but it does the trick.