remove redundant brace following review
add error check