fixed issues ready for merging.