Some little bug fixes