Proposed fix for #335

Moved define to the constructor