Fix other bugs that were introduced with the recent changes. Seems more
stable now;