Improve error handling in setTrackSize, etc