fixed a few bugs
Merge branch 'james'