Fix various issues, including potential crashes Signed-off-by: Felix Fietkau <nbd@nbd.name> (cherry picked from commit 53eab6198b)
53eab6198b