Fixed a bug in CosineSimilarity