Fixed many things
Fixed many issues in martink kernel