fixed duplicate function