Please post the whole code (using the # button to provide right tags) as the snippets don't provide enough insight