cherry picking Scott Bartlett's changes for the bottles dependency