How can I fix this bug?