Fix incorrect array length causing undefined errors

$scope.$id can return valid numeric values. This line will cause an issue on the array length:
instance = instances[id] = new BlockUI(id);

i.e. instances[200] would result to an array length of 201