Fixed variable scope problem and #include bug.