Only local variables not working