rewrite fixed function