change self.id to self[:id] to avoid id overriding methods fixing #240

Fix for issue #240