handle invalid remaining size a bit better