made java input a little bit more threadsafe