Fixed some potential issues