Fixed global variabel issue.