Add more error checking in test