Resolved error in declaring window level var