Bihari’s theorems for discontinuous functions and applications