fixes more bugs from inside code