fixes #2276 Deleting a Form Fails Throws Error

Fixed the issue and committed code for review, please check it.