Fix adding/editing pets and add functional tests