Fixed the closure scope problem