fixed most compile errors, still a linking error