More bug fixing