Little improvements and bug fixes