Various packaging fixes

Details are in the commits.
This should fix bug #1.