Fix bugs from the previous commit