Port back changes from xs64bit branch