Fixed bug with variable being declared twice