Fixes for issues found by Portugao

pull these