first merge with lib_rewrite

http://code.google.com/p/fbug/issues/detail?id=6164