Fixed static variable bug