Kernel 4.8 UFW and SMB not working together

I found the solution, the Arch wiki was updated with this specific problem in mind, they list it as a possible solution but it works on booth my Ubuntu 16.04.2 and Linux Mint 18.1 Cinnamon installations.

Type this in the terminal:

sudo iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns

Since any change to iptables is lost on reboot without a configuration file I installed the iptables-persistent package, this way the 'fix' will not be gone after a system restart. To install type this in the terminal, and save the current rules.

sudo apt install iptables-persistent

Source for solution: https://wiki.archlinux.org/index.php/samba#.22Browsing.22_network_fails_with_.22Failed_to_retrieve_share_list_from_server.22