Important bug fixes