Added some missing files, fixed bugs.