api testing and various bug fixes.