Fixed closure cache serialization problem
Minor code cleaning