Fix losses and Add rank filter

Fix losses and Add rank filter