Bug fixes patch 1