Fixed some potential problems