Remotebackend handle empty result

Fix crash when result is empty array in lookup/list. Also provide a unit test to make sure it won't crash.