Bug fixes

Some little fixes