Modified the build.gradle, and some bugfixes