memcpy partially replaced

Fixed one of exit issues