Fix switch bug in object editing template function