Fix ActivityTest and improve other tests