Fix problems mentioned by Ryan