Stack thread safety issues