Fix bugs caused by previous commit and impaired developer