Fix some mistakes in remy

This is a 'somewhat tested' fix for issues found when compiling remy.