Added check on return value