Some more small fixes:
- use #if defined(sun) where appropriate
- return -1 instead of 1
- add an assertion