Bugs fixed from temp commit