bug fixes for mifosx-519, 516, 361 and 362