fixed various JSON return values and worked around some Angular idiosyncracies