Fix statement not set NULL on deletion
Make local only variables static