Fix various things

Please see this patch