Fix compile-errors from last merge

Last merge seriously messed up the code. Fixed the compile-errors, but
havn't tested the code.