added return value checking.

added return value checking.