Fixed issue with using variables vefore assigned