fixed some bugs, set up rake tasks