Hopefully final bug fixes