Fix problems in code