(Nasty) bug fixes