Fixed rmsubstr comparison condition; Added tests