fixed compile error and removed warnings