Fixed bug with local variables