Bugs and improvments