fix pure java implementation