Triggers fix

Issue #51 and #54 fixes