added check for empty data on /device/data/:id
remove redundant exit