Fixed a couple of exceptions that may have occured with my code.