Updated to work with later versions of pyes