Looks like you have too few braces. Use Ctrl + T to format your code. The mistake should be revealed.