Fix bug reported by Java-san