Fixed double comparison bug: x = -x.
Merge branch 'templates'