Fix bugs from last commit