Return an empty array instead of undefined
Fixed issue with number id=0
Code cleanup