add a few fixes from PlayfulGod