Fix redundant and perhaps even unsafe code