Added a cast to make the code working with OS X 10.10