~ detection and handling fixes