fixing all compile and link errors