Fixes for 7f84c4dd513a21e4749b174d64c62c54ad3a2aeb