not sure why these were originally omitted..
based on patch by orc and Isaac Dunham, with some fixes.