Truncate long bundle names to avoid file system errors

This is #50, rebased with master.