Fix some bugs. Prepare for major update.