use same code for webforge (allthough its aquivalent)
fix wrong replacement for exception