Bug fixes
Minor improvments