bugfixes and all javadoc