finalize bug fixing