ltr: add width, height flags, improve error handling
Merge from parent.