fix a bug in top N