Tests and Fixes

Fixed unit tests and errors that occurred during unit tests