Fixing bug with empty collections