added an extra error check