Changed SD filename generation, made SD handling more reliable as a whole