fixes compilation errors and tests