Fix Exceptions

There were issues with empty collections.