Serious bug fixes