Fixes issue #401

This issue causes error when nested form created programmatically by code or third-party library. Its demonstration can be found on [jsFiddle](http://jsfiddle.net/Rv7DY/).