Better error cheking.