Fixed gradle and ant build scripts, fixed tests