Fix bug #392 by improving empty list/map handling