Added check to make sure resp is not nil