Some random patches required for my thesis