Fixed some build and running issues