small fixes for safer kref access. still not safe enough though