Finished some bug fixes.