Fixed bug where $() with an id was failing.

If an attempt was made to get a non-existing id, $() returned an array
with null. Now it returns an empty array.