Fix functions.sql problems (pMain & pCleanupOOB)

Two fixes for every mod schema\functions.sql;

Fixed issue in pMain that causes an infinite loop if all/final object have 0 spawn chance. (Issue raised by massl)

Fixed syntax error in pCleanupOOB with ISNULL()