Fixed type errors and added support for Darwin

Type inconsistencies shown here:
http://pastebay.net/1463335