Very big bug fixing