diff --git a/hive/db/sql_scripts/condenser_follows.sql b/hive/db/sql_scripts/condenser_follows.sql
index fbfa033f28006311dca9c04c508d6e21a2d61994..035824619169402349509d65a89a4e446ff7263f 100644
--- a/hive/db/sql_scripts/condenser_follows.sql
+++ b/hive/db/sql_scripts/condenser_follows.sql
@@ -27,7 +27,7 @@ BEGIN
   __account_id = find_account_id( _account, True );
   __start_id = find_account_id( _start, _start <> '' );
   IF __start_id <> 0 THEN
-      SELECT INTO __start_id COALESCE( ( SELECT id FROM hive_follows WHERE following = __account_id AND follower = __start_id ), 0 );
+      SELECT INTO __start_id ( SELECT id FROM hive_follows WHERE following = __account_id AND follower = __start_id );
   END IF;
   RETURN QUERY SELECT
      ha.name
@@ -55,7 +55,7 @@ BEGIN
   __account_id = find_account_id( _account, True );
   __start_id = find_account_id( _start, _start <> '' );
   IF __start_id <> 0 THEN
-      SELECT INTO __start_id COALESCE( ( SELECT id FROM hive_follows WHERE follower = __account_id AND following = __start_id ), 0 );
+      SELECT INTO __start_id ( SELECT id FROM hive_follows WHERE follower = __account_id AND following = __start_id );
   END IF;
   RETURN QUERY SELECT
      ha.name
diff --git a/hive/db/sql_scripts/condenser_get_by_replies_to_account.sql b/hive/db/sql_scripts/condenser_get_by_replies_to_account.sql
index a18cd7e97387837d21a55c20ab3ede00985d8a92..c3ea90c1ae7994103d130d5b2f0157ea3e7f287f 100644
--- a/hive/db/sql_scripts/condenser_get_by_replies_to_account.sql
+++ b/hive/db/sql_scripts/condenser_get_by_replies_to_account.sql
@@ -10,20 +10,27 @@ AS
 $function$
 DECLARE
   __post_id INTEGER := 0;
+  __parent_author_id INTEGER := 0;
 BEGIN
 
   IF _permlink <> '' THEN
+
+    __post_id = find_comment_id( _author, _permlink, True );
+
     SELECT
-        ha_pp.name, hp.id
+      pp.author_id
     INTO
-        _author, __post_id
+      __parent_author_id
     FROM hive_posts hp
     JOIN hive_posts pp ON hp.parent_id = pp.id
-    JOIN hive_accounts ha_pp ON ha_pp.id = pp.author_id
-    JOIN hive_permlink_data hpd_pp ON hpd_pp.id = pp.permlink_id
-    JOIN hive_accounts ha ON hp.author_id = ha.id
-    WHERE 
-      hpd_pp.permlink = _permlink AND ha.name =  _author;
+    WHERE hp.id = __post_id;
+  ELSE
+    SELECT
+      id
+    INTO
+      __parent_author_id
+    FROM hive_accounts
+    WHERE name = _author;
   END IF;
 
   RETURN QUERY SELECT
@@ -64,15 +71,8 @@ BEGIN
       hp.is_pinned,
       hp.curator_payout_value
     FROM hive_posts_view hp
-    JOIN
-    (
-	    SELECT hp.id
-	    FROM hive_posts_view hp
-	    WHERE hp.author = _author
-	    ORDER BY hp.id DESC
-	    LIMIT _limit
-    ) T ON hp.parent_id = T.id
-    WHERE ( ( __post_id = 0 ) OR ( hp.id <= __post_id ) )
+    JOIN hive_posts pp ON hp.parent_id = pp.id
+    WHERE pp.author_id = __parent_author_id AND ( ( __post_id = 0 ) OR ( hp.id <= __post_id ) )
     ORDER BY hp.id DESC
     LIMIT _limit;
 
diff --git a/tests/tests_api b/tests/tests_api
index f8ac3e6776ef31f23d14a746b6ba6c281382e9cc..45a18a1ea9617a753a4b1cfac61793247d7adbc8 160000
--- a/tests/tests_api
+++ b/tests/tests_api
@@ -1 +1 @@
-Subproject commit f8ac3e6776ef31f23d14a746b6ba6c281382e9cc
+Subproject commit 45a18a1ea9617a753a4b1cfac61793247d7adbc8