fix challenge calculation
bug fixes