Fixed some problems with triggers. Closes #11.