losses helper functional