mode functions for univariate distributions

In addition, I clean up the modes functions, fixing bugs.