Fixed bug with java