Fixes bugs revealed by Travis