Added check for non success result code