Add supervisor and fix some bugs.