added jquery in order to check for empty object