Makes some bug fixes