Added patrick's fixes