added another error check