Add more logging info and fix several bugs
Improve logging in java-functions