Fix #319 and Fix build.xml

I wanted to submit these separately, but I am new to GitHub