Fix some potential errors