Small modifs and bug fixing