CoursePress SQL error

We have an older version of Coursepress – Due to some work we had done based on it, we cannot update it to the latest version, it will wreck our site completely. Now when we updated WP units started to disappear in the admin area. Sometimes frontend as well.

Here is the query with issue:

SELECT midnaynet_posts.*
FROM midnaynet_posts
AND ( %1$s.post_type = 'module'
AND %1$s.post_parent IN (SELECT ID
FROM %1$s AS wpp
WHERE wpp.post_type = 'unit'
AND wpp.post_parent = %2$d)
OR (%1$s.post_type = 'unit'
AND %1$s.post_parent = %2$d ) )
AND ( %1$s.post_status = 'publish'
OR %1$s.post_status = 'draft' )
ORDER BY midnaynet_posts.menu_order ASC

Could you help us to sort this issue?