Some corrections and bug testing