Fixing variable bug