Add json unauthorized errors
Sort machines properly in location json