Fixed overwrite function